from settings import DEEPSEEK_API_KEY, DEEPSEEK_BASE_URL
from openai import OpenAI

def chat_completions4(query):
    print(f"DEEPSEEK_BASE_URL: {DEEPSEEK_BASE_URL}")  # 调试输出
    print(f"DEEPSEEK_API_KEY: {DEEPSEEK_API_KEY}")    # 调试输出
    client = OpenAI(
        api_key=DEEPSEEK_API_KEY,
        base_url=DEEPSEEK_BASE_URL
    )
    resp = client.chat.completions.create(
        model="deepseek-chat",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": query}
        ]
    )
    return resp.choices[0].message.content

